package com.chris.webservice.ws.common;

import java.io.Serializable;

public enum PosType implements Serializable {

	LBS(0, "LBS"),
	GPS(1, "GPS"),
	GPSCell(2, "GPSCell");
    private int value;
    private String name;

    private PosType(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public static PosType getByValue(int value) {
    	PosType[] posTypes = PosType.values();
        for (PosType posType : posTypes) {
            if (posType.getValue() == value) {
                return posType;
            }
        }

        throw new java.lang.IllegalArgumentException("Can't not found PosType by value '" + value
                + "', please check if use correct PosType value!");
    }
    
    public static PosType getByName(String name) {
    	PosType[] posTypes = PosType.values();
        for (PosType posType : posTypes) {
            if (posType.getName().equals(name)) {
                return posType;
            }
        }

        throw new java.lang.IllegalArgumentException("Can't not found PosType by name '" + name
                + "', please check if use correct PosType name!");
    }
}
